package com.jml.spring.aop注解事务.annotation;

import java.lang.reflect.Method;

public class User {

	@AddAnnotation(userName = "张三" ,arrays = {"1","2"})
	public void add(){

	}

	public static void main(String[] args) throws ClassNotFoundException {
		Class<?> forName = Class.forName("com.jml.spring.aop注解事务.annotation.User");
		Method[] declaredMethods = forName.getDeclaredMethods();
		for (Method method:declaredMethods) {
			AddAnnotation addAnnotation = method.getDeclaredAnnotation(AddAnnotation.class);
			if(addAnnotation==null){
				System.out.println(method.getName());
				System.out.println("该方法没有加注解");
				continue;
			}
			System.out.println(addAnnotation.userId());
			System.out.println(addAnnotation.userName());
			System.out.println(addAnnotation.arrays());
		}
	}
}
